
//1381.设计一个支持增量操作的栈
class CustomStack {
    vector<int> st;
    int num;
public:
    CustomStack(int maxSize) {
        num=maxSize;
    }
    
    void push(int x) {
        if(st.size()==num) return ;
        st.push_back(x);
    }
    
    int pop() {
        if(st.empty()) return -1;
        int ret=st.back();
        st.pop_back();

        return ret;
    }
    
    void increment(int k, int val) {
        for(int i=0;i<k&&i<st.size();i++)
        st[i]+=val;
    }
};

/**
 * Your CustomStack object will be instantiated and called as such:
 * CustomStack* obj = new CustomStack(maxSize);
 * obj->push(x);
 * int param_2 = obj->pop();
 * obj->increment(k,val);
 */